<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>相关页面方法</title>
</head>
<body>
<input type="text">
<input type="button" value="按钮" onclick="f()">
<div>div</div>
<span>span</span>
<p id="p1">p1</p>
<p id="p2">p2</p>
<script>
    function f() {
        //得到div
        let d = document.querySelector("div");
        //修改div的文本内容
        d.innerText = "今天星期五";
        //得到span
        let s = document.querySelector("span");
        s.innerText = "值变了"
        //得到p1
        let p1 = document.querySelector("#p1");
        p1.innerText = "p1变了";
        //得到p2
        let p2 = document.querySelector("#p2");
        p2.innerText = "p2变了";
        let i  =document.querySelector("input");
        //修改空间的值
        i.value="我是文本框";
    }
</script>
</body>
</html>